/*******************************************************************
* ++
* Author        :	ThienTN
* Description   :	Main.cpp in project HumanResource
* 
* Mod. History  :	28/07/2012 - ThienTN
*
* --
*******************************************************************/
#include "Utility.h"
#include "Employee.h"

int main()
{
	bool bFlag = true;
	int nChoice;
	int nEmpType;
	vector <CEmployee> m_list;
	CEmployee *pEmployee;
	do
	{
		//Show menu
		Menu();
		// Input a chose
		cout << "Input your chose: ";
		cin >> nChoice;
		cin.ignore(1);
		switch (nChoice)
		{
		case 1:
			// Input Employee
			char chStop;
			do
			{
				pEmployee = new CEmployee();
				pEmployee->Addtail(m_list, pEmployee);
				End();
				printf("Do you want to continues ? (Y/N) ");
				cin.ignore(1);
				chStop = getchar();
				End();
			}while(chStop != 'n' && chStop != 'N');
			break;
		case 2:
			pEmployee = new CEmployee();
			pEmployee->AutoInputEmployee(m_list);
			End();
			break;
		case 3:
			// Display list Employee
			pEmployee->OutputEmployee(m_list);
			End();
			break;
		case 4:
			// Search a Employee belong to name
			// Input name
			pEmployee->SearchEmployee(m_list);	
			End();
			break;
		case 5:
			// Sort Employee belong to birthday
			pEmployee->SortYear(m_list);
			End();
			break;
		case 6:
			// Sort Employee belong to birthday
			pEmployee->Addtail(m_list, pEmployee);
			End();
			break;
		case 7:
			// Search a Employee belong to name
			pEmployee->RemoveEmployee(m_list);
			End();
			break;
		case 0:
			// Quit program
			bFlag = false;			
			break;
		default:
			// Exception case
			cout << "Please enter another chose\n";
			break;
		}
	}while (bFlag);

	// Release memory using
	//delete pNode;
	return 0;
}